package com.greedy.hateoas.demo.stock.repository;

import com.greedy.hateoas.demo.stock.entity.StocksEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

/**
 * @Author: Yanxy
 * @Date: Created in:2023/07/12
 * Description: 股票数据层服务接口
 */
@RepositoryRestResource(path = "/stocks")
public interface StockRepository extends JpaRepository<StocksEntity, Long> {

    /**
     * 根据股票名称查找所对应的股票数据
     * @param list 股票名称集合
     * @return 股票数据集合
     */
    List<StocksEntity> findByNameInOrderById(@Param("list")List<String> list);

    /**
     * 根据股票名称查询股票信息
     *
     * @param name 股票名称
     * @return 股票信息
     */
    public StocksEntity findByName(@Param("name") String name);

}
